/*****************************************************************************
Copyright(C),2010-2020,DADI MEDIA Co.,Ltd.
ModuleName:Subtitle Control Module 
FileName:SubtitleCtrlModule.cpp
Author:gengkeming@dadimedia.com
Date:10/5/31
Version:v1.0
Description:This source file provide implementation for Subtitle Control Module
Others:
History:
<Author>					<Date>						<Modification>																			
gengkeming@dadimedia.com    			10/05/31					LoginProjector	
gengkeming@dadimedia.com    			10/06/21					comment	
*******************************************************************************/

#include "SubtitleCtrlModule.h"
#include "SubtitleCtrl.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CSubtitleCtrlModule::CSubtitleCtrlModule()
{
	m_psubCtrl = new CSubtitleCtrl();
}
CSubtitleCtrlModule::~CSubtitleCtrlModule()
{
	m_psubCtrl->LogoutProject();
}
/******************************************************************************
Function:LoginProjector
Description:This function is used to login projector
Input:
		name			explain							example
		ipAddr			the IP address of projector				"192.168.0.2"
		ipPort			the port of projector					60000
		userName		login name						"xxxx"
		userPassword    login password					*****
Output:
		none
Return:
		0			success
		not 0		fail
Others:
******************************************************************************/
int CSubtitleCtrlModule::LoginProjector(const char *ipAddr, int ipPort, const char *userName, const char *userPassword)
{
	int iRet = 0;
	iRet = m_psubCtrl->LoginProject(ipAddr,ipPort,userName,userPassword);
	return iRet;
}
/******************************************************************************
Function:PlaySubtitle
Description:This function is used to set offset of subtitle
Input:
		name			explain							example
		subtitleURL		subtitle file url					"http://192.168.0.1/subtitle.xml"

		currenFrameNum		the beginning position					1
					of play subtitle file
Output:
		none
Return:
		0			success
		not 0			fail
Others:
******************************************************************************/
int CSubtitleCtrlModule::PlaySubtitle(const char *subtitleURL,const int currenFrameNum)
{
	int iRet = 0;
	iRet = m_psubCtrl->PlaySub(subtitleURL,currenFrameNum);
	return iRet;
}
/******************************************************************************
Function:StopSubtitle
Description:stop subtitle
Input:
		none
Output:
		none
Return:
		0			success
		not 0			fail
Others:
******************************************************************************/

int CSubtitleCtrlModule::StopSubtitle()
{
	int iRet = 0;
	iRet = m_psubCtrl->StopSub();
	return iRet;
}
/******************************************************************************
Function:LogoutProjector
Description:logout projector
Input:
		none
Output:
		none
Return:
		0			success
		not 0			fail
Others:
******************************************************************************/

int CSubtitleCtrlModule::LogoutProjector()
{
	int iRet = 0; 
	iRet = m_psubCtrl->LogoutProject();
	return iRet;
}
